﻿<UserControl x:Class="KouDai.Phone.Views.NewRankingListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:WPNext="clr-namespace:WPNextTools.NControls;assembly=WPNextTools"
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
             xmlns:vm="clr-namespace:KouDai.Phone.ViewModels"
             FontFamily="{StaticResource PhoneFontFamilyNormal}"
             FontSize="{StaticResource PhoneFontSizeNormal}"
             Foreground="{StaticResource PhoneForegroundBrush}"
             cal:Bind.AtDesignTime="True"
             d:DataContext="{d:DesignInstance Type=vm:NewRankingListViewModel,
                                              IsDesignTimeCreatable=True}"
             d:DesignHeight="800"
             d:DesignWidth="456"
             mc:Ignorable="d">

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <WPNext:PullDownToRefreshPanel x:Name="PullDownRefreshPanel" cal:Message.Attach="[Event RefreshRequested] = [Action PullDownRefresh]" />
        <phone:LongListSelector x:Name="RankingList"
                                GridCellSize="221,260"
                                IsGroupingEnabled="True"
                                ItemsSource="{Binding RankingItems}"
                                LayoutMode="Grid"
                                >
            <phone:LongListSelector.ItemTemplate>
                <DataTemplate>
                    <Button Style="{StaticResource NoBorderNoThicknessButtonStyle}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <cal:ActionMessage MethodName="RankSelectExecute">
                                    <cal:Parameter Value="$dataContext" />
                                </cal:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <Grid Margin="12,12,0,0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="5*" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Image x:Name="HoneyImage"
                                   Source="{Binding ImageUrlForIphone}"
                                   Stretch="UniformToFill" />
                            <Image x:Name="AngleImage"
                                   Width="50"
                                   Height="50"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Top"
                                   Source="/Images/kd_hot_angle.png"
                                   Stretch="Fill" />
                            <TextBlock x:Name="Num"
                                       Width="25"
                                       Height="30"
                                       Margin="5,0,0,0"
                                       HorizontalAlignment="Left"
                                       VerticalAlignment="Top"
                                       FontSize="24"
                                       Text="{Binding Num}" />
                            <StackPanel Grid.Row="1" Orientation="Horizontal">
                                <TextBlock VerticalAlignment="Center"
                                           FontSize="26.667"
                                           Foreground="{StaticResource HotListDarkBrush}"
                                           Text="收藏数：" />
                                <TextBlock x:Name="FavCount"
                                           VerticalAlignment="Center"
                                           Foreground="{StaticResource TextColorLightBrush}"
                                           Text="{Binding FaviorateAmout}" />
                            </StackPanel>
                        </Grid>
                    </Button>
                </DataTemplate>
            </phone:LongListSelector.ItemTemplate>
            <phone:LongListSelector.GroupHeaderTemplate>
                <DataTemplate>
                    <TextBlock Margin="12,0,0,0"
                               VerticalAlignment="Center"
                               FontSize="20"
                               Foreground="{StaticResource HotListLightBrush}"
                               Text="{Binding Title}" />
                </DataTemplate>
            </phone:LongListSelector.GroupHeaderTemplate>
        </phone:LongListSelector>
    </Grid>
</UserControl>